﻿using System;

using SharedGenomics.Core;
using SharedGenomics.Workbench.Core;

namespace SharedGenomics.Workbench.Messages
{
    public class ShowPresenterMessage
    {
        public ShowPresenterMessage(FormDisplayMode displayMode, Type presenterType)
            : this(displayMode, presenterType, null, null)
        {
        }

        public ShowPresenterMessage(FormDisplayMode displayMode, IPresenter existing)
            : this(displayMode, existing, null)
        {
        }

        public ShowPresenterMessage(FormDisplayMode displayMode, Type presenterType, Delegate initialisationAction, Delegate closeAction)
        {
            presenterType.ThrowIfNull("presenterType");
            this.DisplayMode = displayMode;
            this.PresenterType = presenterType;
            this.InitialisationAction = initialisationAction;
            this.CloseAction = closeAction;
        }

        public ShowPresenterMessage(FormDisplayMode displayMode, IPresenter existing, Delegate closeAction)
        {
            existing.ThrowIfNull("existing");
            this.DisplayMode = displayMode;
            this.Existing = existing;
            this.CloseAction = closeAction;
        }

        public Type PresenterType { get; private set; }
        public IPresenter Existing { get; private set; }
        public Delegate InitialisationAction { get; private set; }
        public Delegate CloseAction { get; private set; }
        public FormDisplayMode DisplayMode { get; private set; }
    }
}
